1. Technical Field
The present invention relates generally to an improved data processing system and in particular to an improved method and apparatus for executing programs in a data processing system. Still more particularly, the present invention provides an improved method and apparatus for debugging programs in a data processing system.
2. Description of Related Art
A computer includes both a physical machine, namely the hardware, and the instructions which cause the physical machine to operate, namely the software. Software includes both application and operating system programs. If the program is simply to do tasks for a user, such as solving specific problems, it is referred to as application software. If a program controls the hardware of the computer and the execution of the application programs, it is called operating system software. System software further includes the operating system, the program that controls the actual computer or central processing unit (CPU), and device drivers that control the input and output devices (I/O) such as printers and terminals.
A number of application programs are usually present waiting to use the CPU. The operating system determines which program will run next, how much of the CPU time it will be allowed to use, and what other computer resources the application will be allowed to access and use. Further, each application program will require a special input or output device and the application program must transfer its data to the operating system, which controls the device drivers.
A network containing a number of computers may be formed by having these computers, also referred to as "nodes" or "network computers", communicate with each other over one or more communications links, which is an aggregation which is a computer network. Today, many computer workstations are connected to other workstations, file servers, or other resources in a network. Each computer on a network is connected to the network via an adapter card or other similar means, which provides an ability to establish a communications link to the network.
Applications are often sent to a computer from the server. Java applications are becoming increasingly more prevalent as the type of application sent between server and client computers. Java applications are common on the Internet and becoming more increasingly common in intranets and in other types of networks used in businesses.
Java is an object oriented programming language and environment focusing on defining data as objects and the methods that may be applied to those objects. Java supports only a single inheritance, meaning that each class can inherit from only one other class at any given time. Java also allows for the creation of totally abstract classes known as interfaces, which allow the defining of methods that may be shared with several classes without regard for how other classes are handling the methods.
The Java virtual machine (JVM) is a virtual computer component that resides only in memory. The JVM allows Java programs to be executed on a different platform as opposed to only the one platform for which the code was compiled. Java programs are compiled for the JVM. In this manner, Java is able to support applications for many types of data processing systems, which may contain a variety of central processing units and operating systems architectures. To enable a Java application to execute on different types of data processing systems, a compiler typically generates an architecture-neutral file format--the compiled code is executable on many processors, given the presence of the Java run-time system. The Java compiler generates bytecode instructions that are non-specific to a particular computer architecture. A bytecode is a machine independent code generated by the Java compiler and executed by a Java interpreter. A Java interpreter is a part in the JVM that alternately decodes and interprets a bytecode or bytecodes. These bytecode instructions are designed to be easy to interpret on any computer and easily translated on the fly into native machine code.
JVMs presently have two modes, also called "loops" used to execute bytecodes. One loop is called an assembly loop, which is a standard Java assembly loop, providing speed in executing bytecodes. The assembly loop in the JVM is written in native assembly language for the processor on which the JVM executes. Another loop is called a "C loop", which is typically used in debugging Java programs. This loop is normally written in C language or assembly and is designed to provide debugging functions. For example, a C loop allows for tracing and single stepping through the bytecodes in a Java program. A C loop, however, has a disadvantage of slower speed when compared to an assembly loop. A C loop may be ten times slower than an assembly loop. Thus, C loops are never used in enterprise or production environments.
Current Java operating systems (OSs) are unable to switch between these two loops dynamically. They are compile time options. As a result, users who execute a Java program using an assembly loop must restart the Java operating system (OS) to switch to a C loop to perform debugging of a Java program. The Java OS also must be restarted to execute a Java program when debugging is completed in order to take advantage of the speed provided by the assembly loop in the JVM. Therefore, it would be advantageous to provide an improved method and apparatus for providing debugging functions found in the C loop for debugging while providing the speed that is afforded by the assembly loop without having to restart the Java OS.